const fs = require("fs");
const path = require("path");

let filePath = path.join(__dirname,"1.txt");
let fileObj = fs.statSync(filePath);
let cTime = new Date(fileObj.ctimeMs);

let year = cTime.getFullYear();
let month = cTime.getMonth()+1;
let day = cTime.getDate();
let hour = cTime.getHours();
let minute = cTime.getMinutes();
let second = cTime.getSeconds();

console.log(year+"-" + month+"-" + day+""+hour+
    ":"+minute+":"+second
);
/**
 * 判断当前路径获取到的是文件夹还是文件
 */
fileObj.isFile()/**判断是否为文件 */
fileObj.isDirectory()/**判断是否为文件夹 */
